package com.ruoyi.web.controller.system;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDeviceInfo;
import com.ruoyi.common.core.domain.entity.SysDeviceType;
import com.ruoyi.common.pojo.QueryDeviceListReq;
import com.ruoyi.system.service.SysDeviceInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "设备管理模块")
@RestController
@RequestMapping("/system/device")
public class SysDeviceController {

    @Autowired
    SysDeviceInfoService sysDeviceInfoService;

    @ApiOperation("获取设备类型")
    @ApiOperationSupport(order = 1)
    @PostMapping("/queryDeviceType")
    public AjaxResult queryDeviceType() {
        return sysDeviceInfoService.queryDeviceType();
    }

    @ApiOperation("添加设备类型")
    @ApiOperationSupport(order = 2)
    @PostMapping("/addDeviceType")
    public AjaxResult addDeviceType(@RequestBody SysDeviceType param) {
        return sysDeviceInfoService.addDeviceType(param);
    }

    @ApiOperation("删除设备类型")
    @ApiOperationSupport(order = 3)
    @PostMapping("/deleteDeviceType")
    public AjaxResult deleteDeviceType(@RequestBody SysDeviceType param) {
        return sysDeviceInfoService.deleteDeviceType(param);
    }

    @ApiOperation("修改设备类型")
    @ApiOperationSupport(order = 4)
    @PostMapping("/updateDeviceType")
    public AjaxResult updateDeviceType(@RequestBody SysDeviceType param) {
        return sysDeviceInfoService.updateDeviceType(param);
    }

    @ApiOperation("获取设备列表")
    @ApiOperationSupport(order = 5)
    @PostMapping("/queryDeviceList")
    public AjaxResult queryDeviceList(@RequestBody QueryDeviceListReq param) {
        return sysDeviceInfoService.queryDeviceList(param);
    }

    @ApiOperation("添加设备信息")
    @ApiOperationSupport(order = 6)
    @PostMapping("/addDeviceInfo")
    public AjaxResult addDeviceInfo(@RequestBody SysDeviceInfo param) {
        return sysDeviceInfoService.addDeviceInfo(param);
    }

    @ApiOperation("删除设备信息")
    @ApiOperationSupport(order = 7)
    @PostMapping("/deleteDeviceInfo")
    public AjaxResult deleteDeviceInfo(@RequestBody SysDeviceInfo param) {
        return sysDeviceInfoService.deleteDeviceInfo(param);
    }

    @ApiOperation("更新设备信息")
    @ApiOperationSupport(order = 8)
    @PostMapping("/updateDeviceInfo")
    public AjaxResult updateDeviceInfo(@RequestBody SysDeviceInfo param) {
        return sysDeviceInfoService.updateDeviceInfo(param);
    }


}
